#include <cstdio>
#include <queue>

using namespace std;

const int Limit_Size = 1000000 + 10;

int w[ Limit_Size ], n;

void init( )
{
    int i;
    scanf("%d", &n);
    for ( i = 0; i < n; i++ )
        scanf("%d", &w[ i ]);
}

int findMax( int a, int b, int &a2, int &b2 )
{
    int i, maxSum = -100000000, thisSum = 0, t = a;
    for ( i = a; i <= b; i++ )
    {
        thisSum += w[ i ];
        if ( thisSum > maxSum )
        {
            maxSum = thisSum;
            a2 = t;
            b2 = i;
        }
        if ( thisSum < 0 )
        {
            thisSum = 0;
            t = i + 1;
        }
    }
    return maxSum;
}

int main( )
{
    int t, k, a, b, maxn;
    scanf("%d", &t);
    for ( k = 1; k <= t; k++ )
    {
        init( );
        maxn = findMax( 0, n - 1, a, b );
        printf("Case %d:\n%d %d %d\n", k, maxn, a + 1, b+ 1);
        if ( k != t )
            printf("\n");
    }
    return 0;
}
